<template>
  <div>
    <diyfrom v-if="form_id" :form_id="form_id" :lawyer_Id="lawyer_Id"  modeType="lawyer" v-on:lawyerFun="gofunarr"></diyfrom>
  </div>
</template>

<script>
import diyfrom from "../../../components/diyform";

export default {
  components: { diyfrom },
  data() {
    return {
      form_id: "",
      lawyer_Id:"",
      info:{}
    };
  },
  deactivated(){
     localStorage.removeItem("lawyerForm");
  },
  mounted() {
    this.info=JSON.parse(localStorage.getItem("lawyerForm"));
    this.form_id = this.info.id;
    if(this.info.has_data==1){
      this.lawyer_Id = this.info.data_id;
    }
  },
  methods: {
    gofunarr(data) {
      let json = {
        form_data:data,
        form_id:this.form_id
      }
      $http.post("plugin.lawyer-platform.frontend.controllers.diy-form.saveData",json).then(res => {
        if(res.result == 1){
          this.$toast(res.msg)
          this.$router.go(-1);
        }else{
          this.$toast(res.msg)
        }
      })
    }
  }
};
</script>

<style></style>
